﻿using System;

class FindBit3
{
    static void Main()
    {
        //Exercise 5.
        //Write a boolean expression for finding if the bit 3 (counting from 0) of a given integer is 1 or 0.

        Console.Write("Please enter a number: ");
        int a = int.Parse(Console.ReadLine());     
        Console.WriteLine(Convert.ToString(a,2));
        
        int mask = 1 << 3;
        int check = a & mask;
        int c = check >> 3;
        Console.WriteLine(c);
        bool result = c == 1;
        Console.WriteLine(result ? "Bit 3 is 1." : "Bit 3 is 0.");

    }
}

